package com.augurit;

import org.apache.ibatis.mapping.DatabaseIdProvider;
import org.apache.ibatis.mapping.VendorDatabaseIdProvider;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;
/**
 * 全局异常拦截器
 * <p>
 * 应验收标准的要求代码注释覆盖率要达到 30%
 * <p>
 * 扫描工具无视 swagger 注解的描述， 所以将注释加这。
 * <p>
 * 只要代码命名足够规范， 足够用心， 且是自说明的， 其实注释是多余的
 * <p>
 * 是代码中的一种坏味道(bad smell)
 * <p>
 * 因为注释到后期很少维护， 随着需求的变动， 注释会越来越偏离最开始的说明
 * <p>
 * stupid！！！
 * stupid！！！
 * stupid！！！
 * <p>
 * <p>
 * <p>
 * <p>
 * <p>
 * <p>
 * <p>
 * <p>
 * <p>
 * <p>
 */
@Configuration
@EnableAutoConfiguration(exclude = {MongoAutoConfiguration.class,MongoDataAutoConfiguration.class})
@ComponentScan({"com.augurit.agcloud","org.flowable.app","com.augurit.aplanmis"})
public class CommonApplication {

    @Bean
    public DatabaseIdProvider getDatabaseIdProvider() {
        DatabaseIdProvider databaseIdProvider = new VendorDatabaseIdProvider();
        Properties properties = new Properties();
        properties.setProperty("Oracle", "oracle");
        properties.setProperty("MySQL", "mysql");
        databaseIdProvider.setProperties(properties);
        return databaseIdProvider;
    }

    public static void main(String[] args) {
        SpringApplication.run(CommonApplication.class, args);
    }
}
